export function printPs(ids, node){
          
  print(ids, node, node.$http.adornUrl(`/bdc/cancelregist/printbarcode_ps`))
   
}

function print(ids, node, url){
    node.$http({
      url: url,
      method: 'post',
      data: node.$http.adornData(ids, false)
    }).then(({data}) => {
      if (data && data.code === 0) {
        var json = [];
        var barCodeList = data.barCodeList
        for (var i in barCodeList){
          var barCode = barCodeList[i]
          var text = [barCode.regionName + '  ' + barCode.barCodeType, 
            barCode.dyqr,
            barCode.dyr ];
            json.push({"EntityTypeId": "1001", "Code": barCode.slh, "Text": text}  )
        }

        window.wewin.LabelPrint(json);

      }
      else{
        node.$message.error(data.msg)
      }
    }).catch(err => {
      node.$message.error("系统内部错误")
    console.error(err);            
  }); 
}

export function printPsYg(ids, node){
          
  print(ids, node, node.$http.adornUrl(`/bdc/bdcnoticeregist/printbarcode_ps`))
   
}